<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/1/21
  Time: 13:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>showBooks</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
</head>
<body>
    <table id="showBooks"></table>
    <script>
        layui.use('table',function () {
            var table = layui.table;
            table.render({
                elem:'#showBooks',
                url:'book/selectBooks',
                page:true,
                limit:3,
                limits:[3,6,9],
                cols:[[
                    {field:'id',title:'图书编号',width:160,sort:true,fixed:'left'},
                    {field:'name',title:'图书名称',width:160,templet:function (d) {
                            console.log(d);
                            return '<a href="#">'+d.name+'</a>';
                        }},
                    {field:'price',title:'图书价格',width:160,sort:true},
                    {field:'state',title:'图书状态',width:160,templet:function (d) {
                            if(d.state==0){
                                return '上架'
                            }else{
                                return '下架'
                            }
                        }},
                    {field:'press_date',title:'出版时间',width:177},
                ]]
            })
        })
    </script>
</body>
</html>
